home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / emacs-complete / fsf / emacs / info / emacs-14 (.txt) < prev    next >
GNU Info File  |  1994-10-05  |  48KB  |  869 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.54 from the
  2. input file emacs.texi.
  3. File: emacs,  Node: Dired Deletion,  Next: Flagging Many Files,  Prev: Dired Commands,  Up: Dired
  4. Deleting Files with Dired
  5. =========================
  6.    The primary use of Dired is to "flag" files for deletion and then
  7. delete the files previously flagged.
  8.      Flag this file for deletion.
  9.      Remove deletion flag on this line.
  10. `DEL'
  11.      Move point to previous line and remove the deletion flag on that
  12.      line.
  13.      Delete the files that are flagged for deletion.
  14.    You can flag a file for deletion by moving to the line describing the
  15. file and typing `d'.  The deletion flag is visible as a `D' at the
  16. beginning of the line.  This command moves point to the next line, so
  17. that repeated `d' commands flag successive files.  A numeric argument
  18. serves as a repeat count.
  19.    The files are flagged for deletion rather than deleted immediately to
  20. reduce the danger of deleting a file accidentally.  Until you direct
  21. Dired to expunge the flagged files, you can remove deletion flags using
  22. the commands `u' and DEL.  `u' works just like `d', but removes flags
  23. rather than making flags.  DEL moves upward, removing flags; it is like
  24. `u' with numeric argument automatically negated.
  25.    To delete the flagged files, type `x' (`dired-expunge').  This
  26. command first displays a list of all the file names flagged for
  27. deletion, and requests confirmation with `yes'.  If you confirm, Dired
  28. deletes the flagged files, then deletes their lines from the text of
  29. the Dired buffer.  The shortened Dired buffer remains selected.
  30.    If you answer `no' or quit with `C-g' when asked to confirm, you
  31. return immediately to Dired, with the deletion flags still present in
  32. the buffer, and no files actually deleted.
  33. File: emacs,  Node: Flagging Many Files,  Next: Dired Visiting,  Prev: Dired Deletion,  Up: Dired
  34. Flagging Many Files
  35. ===================
  36.      Flag all auto-save files (files whose names start and end with `#')
  37.      for deletion (*note Auto Save::.).
  38.      Flag all backup files (files whose names end with `~') for deletion
  39.      (*note Backup::.).
  40. `. (Period)'
  41.      Flag excess numeric backup files for deletion.  The oldest and
  42.      newest few backup files of any one file are exempt; the middle
  43.      ones are flagged.
  44. `% d REGEXP RET'
  45.      Flag for deletion all files whose names match the regular
  46.      expression REGEXP (`dired-flag-files-regexp').  `%d' is like `% m'
  47.      except that it flags files with `D' instead of marking with `*'.
  48.      *Note Marks vs Flags::.
  49.    The `#', `~' and `.' commands flag many files for deletion, based on
  50. their file names.  These commands are useful precisely because they do
  51. not actually delete any files; you can remove the deletion flags from
  52. any flagged files that you really wish to keep.
  53.    `#' flags for deletion all files whose names look like auto-save
  54. files (*note Auto Save::.)--that is, files whose names begin and end
  55. with `#'.  `~' flags for deletion all files whose names say they are
  56. backup files (*note Backup::.)--that is, whose names end in `~'.
  57.    `.' (Period) flags just some of the backup files for deletion: all
  58. but the oldest few and newest few backups of any one file.  Normally
  59. `dired-kept-versions' (*not* `kept-new-versions'; that applies only
  60. when saving) specifies the number of newest versions of each file to
  61. keep, and `kept-old-versions' specifies the number of oldest versions
  62. to keep.
  63.    Period with a positive numeric argument, as in `C-u 3 .', specifies
  64. the number of newest versions to keep, overriding
  65. `dired-kept-versions'.  A negative numeric argument overrides
  66. `kept-old-versions', using minus the value of the argument to specify
  67. the number of oldest versions of each file to keep.
  68.    The `% d' command flags all files whose names match a specified
  69. regular expression (`dired-flag-files-regexp').  Only the non-directory
  70. part of the file name is used in matching.  You can use `^' and `$' to
  71. anchor matches.  You can exclude subdirectories by hiding them (*note
  72. Hiding Subdirectories::.).
  73. File: emacs,  Node: Dired Visiting,  Next: Marks vs Flags,  Prev: Flagging Many Files,  Up: Dired
  74. Visiting Files in Dired
  75. =======================
  76.    There are several Dired commands for visiting or examining the files
  77. listed in the Dired buffer.  All of them apply to the current line's
  78. file; if that file is really a directory, these commands invoke Dired on
  79. that subdirectory (making a separate Dired buffer).
  80.      Visit the file described on the current line, like typing `C-x C-f'
  81.      and supplying that file name (`dired-find-file').  *Note
  82.      Visiting::.
  83.      Like `f', but uses another window to display the file's buffer
  84.      (`dired-find-file-other-window').  The Dired buffer remains visible
  85.      in the first window.  This is like using `C-x 4 C-f' to visit the
  86.      file.  *Note Windows::.
  87. `C-o'
  88.      Visit the file described on the current line, and display the
  89.      buffer in another window, but do not select that window
  90.      (`dired-display-file').
  91. `Mouse-2'
  92.      Visit the file named by the line you click on
  93.      (`dired-mouse-find-file-other-window').  This uses another window
  94.      to display the file, like the `o' command.
  95.      View the file described on the current line, using `M-x view-file'
  96.      (`dired-view-file').
  97.      Viewing a file is like visiting it, but is slanted toward moving
  98.      around in the file conveniently and does not allow changing the
  99.      file.  *Note View File: Misc File Ops.
  100. File: emacs,  Node: Marks vs Flags,  Next: Operating on Files,  Prev: Dired Visiting,  Up: Dired
  101. Dired Marks vs. Flags
  102. =====================
  103.    Instead of flagging a file with `D', you can "mark" the file with
  104. some other character (usually `*').  Most Dired commands to operate on
  105. files, aside from "expunge" (`x'), look for files marked with `*'.
  106.    Here are some commands for marking with `*' (and also for
  107. unmarking).  (*Note Dired Deletion::, for commands to flag and unflag
  108. files.)
  109.      Mark the current file with `*' (`dired-mark').  With a numeric
  110.      argument N, mark the next N files starting with the current file.
  111.      (If N is negative, mark the previous -N files.)
  112.      Mark all executable files with `*' (`dired-mark-executables').
  113.      With a numeric argument, unmark all those files.
  114.      Mark all symbolic links with `*' (`dired-mark-symlinks').  With a
  115.      numeric argument, unmark all those files.
  116.      Mark with `*' all files which are actually directories, except for
  117.      `.' and `..' (`dired-mark-directories').  With a numeric argument,
  118.      unmark all those files.
  119. `M-DEL MARKCHAR'
  120.      Remove all marks that use the character MARKCHAR
  121.      (`dired-unmark-all-files').  If you specify RET as MARKCHAR, this
  122.      command removes all marks, no matter what the marker character is.
  123.      With a numeric argument, this command queries about each marked
  124.      file, asking whether to remove its mark.  You can answer `y'
  125.      meaning yes, `n' meaning no, `!' to remove the marks from the
  126.      remaining files without asking about them.
  127. `c OLD NEW'
  128.      Replace all marks that use the character OLD with marks that use
  129.      the character NEW (`dired-change-marks').  This command is the
  130.      primary way to create or use marks other than `*' or `D'.  The
  131.      arguments are single characters--do not use RET to terminate them.
  132.      You can use almost any character as a mark character by means of
  133.      this command, to distinguish various classes of files.  If OLD is a
  134.      space (` '), then the command operates on all unmarked files; if
  135.      NEW is a space, then the command unmarks the files it acts on.
  136.      To illustrate the power of this command, here is how to put `*'
  137.      marks on all the files that are unmarked, while unmarking all
  138.      those that have `*' marks:
  139.           c * t  c SPC *  c t SPC
  140. `% m REGEXP RET'
  141.      Mark (with `*') all files whose names match the regular expression
  142.      REGEXP (`dired-mark-files-regexp').
  143.      Only the non-directory part of the file name is used in matching.
  144.      Use `^' and `$' to anchor matches.  Exclude subdirectories by
  145.      hiding them (*note Hiding Subdirectories::.).
  146. File: emacs,  Node: Operating on Files,  Next: Shell Commands in Dired,  Prev: Marks vs Flags,  Up: Dired
  147. Operating on Files
  148. ==================
  149.    This section describes the basic Dired commands to operate on one
  150. file or several files.  All of these commands are capital letters; all
  151. of them use the minibuffer, either to read an argument or to ask for
  152. confirmation, before they act.  All use the following convention to
  153. decide which files to manipulate:
  154.    * If you give the command a numeric prefix argument N, it operates
  155.      on the next N files, starting with the current file.  (If N is
  156.      negative, the command operates on the -N files preceding the
  157.      current line.)
  158.    * Otherwise, if some files are marked with `*', the command operates
  159.      on all those files.
  160.    * Otherwise, the command operates on the current file only.
  161.    Here are the file-manipulating commands that operate on files in this
  162. way.  (Some other Dired commands, such as `!' and the `%' commands, use
  163. the same conventions to decide which files to work on.)
  164. `C NEW RET'
  165.      Copy the specified files (`dired-do-copy').  The argument NEW is
  166.      the directory to copy into, or (if copying a single file) the new
  167.      name.
  168.      If `dired-copy-preserve-time' is non-`nil', then copying with this
  169.      command sets the modification time of the new file to be the same
  170.      as that of the old file.
  171. `R NEW RET'
  172.      Rename the specified files (`dired-do-rename').  The argument NEW
  173.      is the directory to rename into, or (if renaming a single file)
  174.      the new name.
  175.      Dired automatically changes the visited file name of buffers
  176.      associated with renamed files so that they refer to the new names.
  177. `H NEW RET'
  178.      Make hard links to the specified files (`dired-do-hardlink').  The
  179.      argument NEW is the directory to make the links in, or (if making
  180.      just one link) the name to give the link.
  181. `S NEW RET'
  182.      Make symbolic links to the specified files (`dired-do-symlink').
  183.      The argument NEW is the directory to make the links in, or (if
  184.      making just one link) the name to give the link.
  185. `M MODESPEC RET'
  186.      Change the mode (also called "permission bits") of the specified
  187.      files (`dired-do-chmod').  This uses the `chmod' program, so
  188.      MODESPEC can be any argument that `chmod' can handle.
  189. `G NEWGROUP RET'
  190.      Change the group of the specified files to NEWGROUP
  191.      (`dired-do-chgrp').
  192. `O NEWOWNER RET'
  193.      Change the owner of the specified files to NEWOWNER
  194.      (`dired-do-chown').  (On most systems, only the superuser can do
  195.      this.)
  196.      The variable `dired-chown-program' specifies the name of the
  197.      program to use to do the work (different systems put `chown' in
  198.      different places).
  199. `P COMMAND RET'
  200.      Print the specified files (`dired-do-print').  You must specify the
  201.      command to print them with, but the minibuffer starts out with a
  202.      suitable guess made using the variables `lpr-command' and
  203.      `lpr-switches' (the same variables that `lpr-file' uses; *note
  204.      Hardcopy::.).
  205.      Compress or uncompress the specified files (`dired-do-compress').
  206.      If the file appears to be a compressed file, it is uncompressed;
  207.      otherwise, it is compressed.
  208.      Load the specified Emacs Lisp files (`dired-do-load').  *Note Lisp
  209.      Libraries::.
  210.      Byte compile the specified Emacs Lisp files
  211.      (`dired-do-byte-compile').  *Note Byte Compilation: (elisp)Byte
  212.      Compilation.
  213. File: emacs,  Node: Shell Commands in Dired,  Next: Transforming File Names,  Prev: Operating on Files,  Up: Dired
  214. Shell Commands in Dired
  215. =======================
  216.    The dired command `!' (`dired-do-shell-command') reads a shell
  217. command string in the minibuffer and runs that shell command on all the
  218. specified files.  There are two ways of applying a shell command to
  219. multiple files:
  220.    * If you use `*' in the shell command, then it runs just once, with
  221.      the list of file names substituted for the `*'.  The order of file
  222.      names is the order of appearance in the Dired buffer.
  223.      Thus, `! tar cf foo.tar * RET' runs `tar' on the entire list of
  224.      file names, putting them into one tar file `foo.tar'.
  225.    * If the command string doesn't contain `*', then it runs once *for
  226.      each file*, with the file name added at the end.
  227.      For example, `! uudecode RET' runs `uudecode' on each file.
  228.    What if you want to run the shell command once for each file but with
  229. the file name inserted in the middle?  Or if you want to use the file
  230. names in a more complicated fashion?  Use a shell loop.  For example,
  231. this shell command would run `uuencode' on each of the specified files,
  232. writing the output into a corresponding `.uu' file:
  233.      for file in *; uuencode $file $file >$file.uu; done
  234.    The working directory for the shell command is the top level
  235. directory of the Dired buffer.
  236.    The `!' command does not attempt to update the Dired buffer to show
  237. new or modified files, because it doesn't really understand shell
  238. commands, and does not know what files the shell command changed.  Use
  239. the `g' command to update the Dired buffer (*note Dired Updating::.).
  240. File: emacs,  Node: Transforming File Names,  Next: Comparison in Dired,  Prev: Shell Commands in Dired,  Up: Dired
  241. Transforming File Names in Dired
  242. ================================
  243.    Here are commands that alter file names in a systematic way:
  244. `% u'
  245.      Rename each of the selected files to an upper case name
  246.      (`dired-upcase').  If the old file names are `Foo' and `bar', the
  247.      new names are `FOO' and `BAR'.
  248. `% l'
  249.      Rename each of the selected files to a lower case name
  250.      (`dired-downcase').  If the old file names are `Foo' and `bar',
  251.      the new names are `foo' and `bar'.
  252. `% R FROM RET TO RET'
  253. `% C FROM RET TO RET'
  254. `% H FROM RET TO RET'
  255. `% S FROM RET TO RET'
  256.      These four commands rename, copy, make hard links and make soft
  257.      links, in each case computing the new name by regular expression
  258.      substitution from the name of the old file.
  259.    The four regular expression substitution commands effectively perform
  260. `query-replace-regexp' on the selected file names in the Dired buffer.
  261. They read two arguments: a regular expression FROM, and a substitution
  262. pattern TO.
  263.    The commands match each "old" file name against the regular
  264. expression FROM, and then replace the matching part with TO.  You can
  265. use `\&' and `\DIGIT' in TO to refer to all or part of what the pattern
  266. matched in the old file name, as in `query-replace' (*note Query
  267. Replace::.).  If the regular expression matches more than once in a
  268. file name, only the first match is replaced.
  269.    For example, `% R ^.*$ RET x-\& RET' renames each selected file by
  270. prepending `x-' to its name.  The inverse of this, removing `x-' from
  271. the front of each file name, is also possible: one method is `% R
  272. ^x-\(.*\)$ RET \1 RET'; another is `% R ^x- RET RET'.  (Use `^' and `$'
  273. to anchor matches that should span the whole filename.)
  274.    Normally, the replacement process does not consider the files'
  275. directory names; it operates on the file name within the directory.  If
  276. you specify a numeric argument of zero, then replacement affects the
  277. entire absolute file name including directory name.
  278.    Often you will want to apply the command to all files matching the
  279. same REGEXP that you use in the command.  To do this, mark those files
  280. with `% m REGEXP RET', then use the same regular expression in the
  281. command to operate on the files.  To make this easier, the `%' commands
  282. to operate on files use the last regular expression specified in any
  283. `%' command as a default.
  284. File: emacs,  Node: Comparison in Dired,  Next: Subdirectories in Dired,  Prev: Transforming File Names,  Up: Dired
  285. File Comparison with Dired
  286. ==========================
  287.    Here are two Dired commands that compare specified files using
  288. `diff'.
  289.      Compare the current file (the file at point) with another file
  290.      (the file at the mark) using the `diff' program (`dired-diff').
  291.      The file at the mark is the first argument of `diff', and the file
  292.      at point is the second argument.
  293. `M-='
  294.      Compare the current file with its latest backup file
  295.      (`dired-backup-diff').  If the current file is itself a backup,
  296.      compare it with the file it is a backup of; this way, you can
  297.      compare a file with any backup version of your choice.
  298.      The backup file is the first file given to `diff'.
  299. File: emacs,  Node: Subdirectories in Dired,  Next: Subdirectory Motion,  Prev: Comparison in Dired,  Up: Dired
  300. Subdirectories in Dired
  301. =======================
  302.    A Dired buffer displays just one directory in the normal case; but
  303. you can optionally include its subdirectories as well.
  304.    The simplest way to include multiple directories in one Dired buffer
  305. is to specify the options `-lR' for running `ls'.  (If you give a
  306. numeric argument when you run Dired, then you can specify these options
  307. in the minibuffer.)  That produces a recursive directory listing showing
  308. all subdirectories at all levels.
  309.    But usually all the subdirectories are too many; usually you will
  310. prefer to include specific subdirectories only.  You can do this with
  311. the `i' command:
  312.      Insert the contents of a subdirectory later in the buffer.
  313.    Use the `i' (`dired-maybe-insert-subdir') command on a line that
  314. describes a file which is a directory.  It inserts the contents of that
  315. directory into the same Dired buffer, and moves there.  Inserted
  316. subdirectory contents follow the top-level directory of the Dired
  317. buffer, just as they do in `ls -lR' output.
  318.    If the subdirectory's contents are already present in the buffer, the
  319. `i' command just moves to it.
  320.    In either case, `i' sets the Emacs mark before moving, so `C-u
  321. C-SPC' takes you back to the old position in the buffer (the line
  322. describing that subdirectory).
  323.    Use the `l' command (`dired-do-redisplay') to update the
  324. subdirectory's contents.  Use `k' to delete the subdirectory.  *Note
  325. Dired Updating::.
  326. File: emacs,  Node: Subdirectory Motion,  Next: Hiding Subdirectories,  Prev: Subdirectories in Dired,  Up: Dired
  327. Moving Over Subdirectories
  328. ==========================
  329.    When a Dired buffer lists subdirectories, you can use the page motion
  330. commands `C-x [' and `C-x ]' to move by entire directories.
  331.    The following commands move across, up and down in the tree of
  332. directories within one Dired buffer.  They move to "directory header
  333. lines", which are the lines that give a directory's name, at the
  334. beginning of the directory's contents.
  335. `C-M-n'
  336.      Go to next subdirectory header line, regardless of level
  337.      (`dired-next-subdir').
  338. `C-M-p'
  339.      Go to previous subdirectory header line, regardless of level
  340.      (`dired-prev-subdir').
  341. `C-M-u'
  342.      Go up to the parent directory's header line (`dired-tree-up').
  343. `C-M-d'
  344.      Go down in the directory tree, to the first subdirectory's header
  345.      line (`dired-tree-down').
  346. File: emacs,  Node: Hiding Subdirectories,  Next: Dired Updating,  Prev: Subdirectory Motion,  Up: Dired
  347. Hiding Subdirectories
  348. =====================
  349.    "Hiding" a subdirectory means to make it invisible, except for its
  350. header line, via selective display (*note Selective Display::.).
  351.      Hide or reveal the subdirectory that point is in, and move point
  352.      to the next subdirectory (`dired-hide-subdir').  A numeric
  353.      argument serves as a repeat count.
  354. `M-$'
  355.      Hide all subdirectories in this Dired buffer, leaving only their
  356.      header lines (`dired-hide-all').  Or, if any subdirectory is
  357.      currently hidden, make all subdirectories visible again.  You can
  358.      use this command to get an overview in very deep directory trees
  359.      or to move quickly to subdirectories far away.
  360.    Ordinary Dired commands never consider files inside a hidden
  361. subdirectory.  For example, the commands to operate on marked files
  362. ignore files in hidden directories even if they are marked.  Thus you
  363. can use hiding to temporarily exclude subdirectories from operations
  364. without having to remove the markers.
  365.    The subdirectory hiding commands toggle; that is, they hide what was
  366. visible, and show what was hidden.
  367. File: emacs,  Node: Dired Updating,  Next: Dired and Find,  Prev: Hiding Subdirectories,  Up: Dired
  368. Updating the Dired Buffer
  369. =========================
  370.    This section describes commands to update the Dired buffer to reflect
  371. outside (non-Dired) changes in the directories and files, and to delete
  372. part of the Dired buffer.
  373.      Update the entire contents of the Dired buffer (`revert-buffer').
  374.      Update the specified files (`dired-do-redisplay').
  375.      Delete the specified *file lines*--not the files, just the lines
  376.      (`dired-do-kill-lines').
  377.      Toggle between sorting by file name and sorting by date/time
  378.      (`dired-sort-toggle-or-edit').
  379. `C-u s SWITCHES RET'
  380.      Refresh the Dired buffer using SWITCHES as
  381.      `dired-listing-switches'.
  382.    Type `g' (`revert-buffer') to update the contents of the Dired
  383. buffer, based on changes in the files and directories listed.  This
  384. preserves all marks except for those on files that have vanished.
  385. Hidden subdirectories are updated but remain hidden.
  386.    To update only some of the files, type `l' (`dired-do-redisplay').
  387. This command applies to the next N files, or to the marked files if
  388. any, or to the current file.  Updating them means reading their current
  389. status from the file system and changing the buffer to reflect it
  390. properly.
  391.    If you use `l' on a subdirectory header line, it updates the
  392. contents of the corresponding subdirectory.
  393.    To delete the specified *file lines*--not the files, just the
  394. lines--type `k' (`dired-do-kill-lines').  This command applies to the
  395. next N files, or to the marked files if any, or to the current file.
  396.    If you kill the line for a file that is a directory, the directory's
  397. contents are also deleted from the buffer.  Typing `C-u k' on the
  398. header line for a subdirectory is another way to delete a subdirectory
  399. from the Dired buffer.
  400.    The `g' command brings back any individual lines that you have
  401. killed in this way, but not subdirectories--you must use `i' to
  402. reinsert each subdirectory.
  403.    The files in a Dired buffers are normally in listed alphabetical
  404. order by file names.  Alternatively Dired can sort them by date/time.
  405. The Dired command `s' (`dired-sort-toggle-or-edit') switches between
  406. these two sorting modes.  The mode line in a Dired buffer indicates
  407. which way it is currently sorted--by name, or by date.
  408.    `C-u s SWITCHES RET' lets you specify a new value for
  409. `dired-listing-switches'.
  410. File: emacs,  Node: Dired and Find,  Prev: Dired Updating,  Up: Dired
  411. Dired and `find'
  412. ================
  413.    You can select a set of files for display in a Dired buffer more
  414. flexibly by using the `find' utility to choose the files.
  415.    To search for files with names matching a wildcard pattern use `M-x
  416. find-name-dired'.  It reads arguments DIRECTORY and PATTERN, and
  417. chooses all the files in DIRECTORY or its subdirectories whose
  418. individual names match PATTERN.
  419.    The files thus chosen are displayed in a Dired buffer in which the
  420. ordinary Dired commands are available.
  421.    If you want to test the contents of files, rather than their names,
  422. use `M-x find-grep-dired'.  This command reads two minibuffer
  423. arguments, DIRECTORY and REGEXP; it chooses all the files in DIRECTORY
  424. or its subdirectories that contain a match for REGEXP.  It works by
  425. running the programs `find' and `grep'.
  426.    The most general command in this series is `M-x find-dired', which
  427. lets you specify any condition that `find' can test.  It takes two
  428. minibuffer arguments, DIRECTORY and FIND-ARGS; it runs `find' in
  429. DIRECTORY, passing FIND-ARGS to tell `find' what condition to test.  To
  430. use this command, you need to know how to use `find'.
  431. File: emacs,  Node: Calendar/Diary,  Next: GNUS,  Prev: Dired,  Up: Top
  432. The Calendar and the Diary
  433. **************************
  434.    Emacs provides the functions of a desk calendar, with a diary of
  435. planned or past events.  To enter the calendar, type `M-x calendar';
  436. this displays a three-month calendar centered on the current month, with
  437. point on the current date.  With a numeric argument, as in `C-u M-x
  438. calendar', it prompts you for the month and year to be the center of the
  439. three-month calendar.  The calendar uses its own buffer, whose major
  440. mode is Calendar mode.
  441.    To exit the calendar, type `q'.  `Mouse-3' in the calendar brings up
  442. a menu of commonly used calendar features.  *Note Customizing the
  443. Calendar and Diary: (elisp)Calendar, for customization information
  444. about the calendar and diary.
  445. * Menu:
  446. * Calendar Motion::       Moving through the calendar; selecting a date.
  447. * Scroll Calendar::       Bringing earlier or later months onto the screen.
  448. * Counting Days::         How many days are there between two dates?
  449. * General Calendar::      Exiting or recomputing the calendar.
  450. * Holidays::              Displaying dates of holidays.
  451. * Sunrise/Sunset::        Displaying local times of sunrise and sunset.
  452. * Lunar Phases::          Displaying phases of the moon.
  453. * Other Calendars::       Converting dates to other calendar systems.
  454. * Diary::                 Displaying events from your diary.
  455. * Appointments::      Reminders when it's time to do something.
  456. * Daylight Savings::      How to specify when daylight savings time is active.
  457. File: emacs,  Node: Calendar Motion,  Next: Scroll Calendar,  Up: Calendar/Diary
  458. Movement in the Calendar
  459. ========================
  460.    Calendar mode lets you move through the calendar in logical units of
  461. time such as days, weeks, months, and years.  If you move outside the
  462. three months originally displayed, the calendar display "scrolls"
  463. automatically through time to make the selected date visible.  Moving to
  464. a date lets you view its holidays or diary entries, convert it to other
  465. calendars; moving longer time periods is also useful simply to scroll
  466. the calendar.
  467. * Menu:
  468. * Calendar Unit Motion::      Moving by days, weeks, months, and years.
  469. * Move to Beginning or End::  Moving to start/end of weeks, months, and years.
  470. * Specified Dates::           Moving to the current date or another
  471.                                 specific date.
  472. File: emacs,  Node: Calendar Unit Motion,  Next: Move to Beginning or End,  Up: Calendar Motion
  473. Motion by Standard Lengths of Time
  474. ----------------------------------
  475.    The commands for movement in the calendar buffer parallel the
  476. commands for movement in text.  You can move forward and backward by
  477. days, weeks, months, and years.
  478. `C-f'
  479.      Move point one day forward (`calendar-forward-day').
  480. `C-b'
  481.      Move point one day backward (`calendar-backward-day').
  482. `C-n'
  483.      Move point one week forward (`calendar-forward-week').
  484. `C-p'
  485.      Move point one week backward (`calendar-backward-week').
  486. `M-}'
  487.      Move point one month forward (`calendar-forward-month').
  488. `M-{'
  489.      Move point one month backward (`calendar-backward-month').
  490. `C-x ]'
  491.      Move point one year forward (`calendar-forward-year').
  492. `C-x ['
  493.      Move point one year backward (`calendar-forward-year').
  494.    The day and week commands are natural analogues of the usual Emacs
  495. commands for moving by characters and by lines.  Just as `C-n' usually
  496. moves to the same column in the following line, in Calendar mode it
  497. moves to the same day in the following week.  And `C-p' moves to the
  498. same day in the previous week.
  499.    The arrow keys are equivalent to `C-f', `C-b', `C-n' and `C-p', just
  500. as they normally are in other modes.
  501.    The commands for motion by months and years work like those for
  502. weeks, but move a larger distance.  The month commands `M-}' and `M-{'
  503. move forward or backward by an entire month's time.  The year commands
  504. `C-x ]' and `C-x [' move forward or backward a whole year.
  505.    The easiest way to remember these commands is to consider months and
  506. years analogous to paragraphs and pages of text, respectively.  But the
  507. commands themselves are not quite analogous.  The ordinary Emacs
  508. paragraph commands move to the beginning or end of a paragraph, whereas
  509. these month and year commands move by an entire month or an entire
  510. year, which usually involves skipping across the end of a month or year.
  511.    All these commands accept a numeric argument as a repeat count.  For
  512. convenience, the digit keys and the minus sign specify numeric
  513. arguments in Calendar mode even without the Meta modifier.  For example,
  514. `100 C-f' moves point 100 days forward from its present location.
  515. File: emacs,  Node: Move to Beginning or End,  Next: Specified Dates,  Prev: Calendar Unit Motion,  Up: Calendar Motion
  516. Beginning or End of Week, Month or Year
  517. ---------------------------------------
  518.    A week (or month, or year) is not just a quantity of days; we think
  519. of weeks (months, years) as starting on particular dates.  So Calendar
  520. mode provides commands to move to the beginning or end of a week, month
  521. or year:
  522. `C-a'
  523.      Move point to start of week (`calendar-beginning-of-week').
  524. `C-e'
  525.      Move point to end of week (`calendar-end-of-week').
  526. `M-a'
  527.      Move point to start of month (`calendar-beginning-of-month').
  528. `M-e'
  529.      Move point to end of month (`calendar-end-of-month').
  530. `M-<'
  531.      Move point to start of year (`calendar-beginning-of-year').
  532. `M->'
  533.      Move point to end of year (`calendar-end-of-year').
  534.    These commands also take numeric arguments as repeat counts, with the
  535. repeat count indicating how many weeks, months, or years to move
  536. backward or forward.
  537.    By default, weeks begin on Sunday.  To make them begin on Monday
  538. instead, set the variable `calendar-week-start-day' to 1.
  539. File: emacs,  Node: Specified Dates,  Prev: Move to Beginning or End,  Up: Calendar Motion
  540. Specified Dates
  541. ---------------
  542.    Calendar mode provides commands for moving to a particular date
  543. specified in various ways.
  544. `g d'
  545.      Move point to specified date (`calendar-goto-date').
  546.      Center calendar around specified month (`calendar-other-month').
  547.      Move point to today's date (`calendar-goto-today').
  548.    `g d' (`calendar-goto-date') prompts for a year, a month, and a day
  549. of the month, and then moves to that date.  Because the calendar
  550. includes all dates from the beginning of the current era, you must type
  551. the year in its entirety; that is, type `1990', not `90'.
  552.    `o' (`calendar-other-month') prompts for a month and year, then
  553. centers the three-month calendar around that month.
  554.    You can return to today's date with `.' (`calendar-goto-today').
  555. File: emacs,  Node: Scroll Calendar,  Next: Counting Days,  Prev: Calendar Motion,  Up: Calendar/Diary
  556. Scrolling in the Calendar
  557. =========================
  558.    The calendar display scrolls automatically through time when you
  559. move out of the visible portion.  You can also scroll it manually.
  560. Imagine that the calendar window contains a long strip of paper with
  561. the months on it.  Scrolling it means moving the strip so that new
  562. months become visible in the window.
  563. `C-x <'
  564.      Scroll calendar one month forward (`scroll-calendar-left').
  565. `C-x >'
  566.      Scroll calendar one month backward (`scroll-calendar-right').
  567. `C-v'
  568. `NEXT'
  569.      Scroll calendar three months forward
  570.      (`scroll-calendar-left-three-months').
  571. `M-v'
  572. `PRIOR'
  573.      Scroll calendar three months backward
  574.      (`scroll-calendar-right-three-months').
  575.    The most basic calendar scroll commands scroll by one month at a
  576. time.  This means that there are two months of overlap between the
  577. display before the command and the display after.  `C-x <' scrolls the
  578. calendar contents one month to the left; that is, it moves the display
  579. forward in time.  `C-x >' scrolls the contents to the right, which
  580. moves backwards in time.
  581.    The commands `C-v' and `M-v' scroll the calendar by an entire
  582. "screenful"--three months--in analogy with the usual meaning of these
  583. commands.  `C-v' makes later dates visible and `M-v' makes earlier
  584. dates visible.  These commands take a numeric argument as a repeat
  585. count; in particular, since `C-u' multiplies the next command by four,
  586. typing `C-u C-v' scrolls the calendar forward by a year and typing `C-u
  587. M-v' scrolls the calendar backward by a year.
  588.    The function keys NEXT and PRIOR are equivalent to `C-v' and `M-v',
  589. just as they are in other modes.
  590. File: emacs,  Node: Counting Days,  Next: General Calendar,  Prev: Scroll Calendar,  Up: Calendar/Diary
  591. Counting Days
  592. =============
  593. `M-='
  594.      Display the number of days in the current region
  595.      (`calendar-count-days-region').
  596.    To determine the number of days in the region, type `M-='
  597. (`calendar-count-days-region').  The numbers of days printed is
  598. *inclusive*; that is, it includes the days specified by mark and point.
  599. File: emacs,  Node: General Calendar,  Next: Holidays,  Prev: Counting Days,  Up: Calendar/Diary
  600. Miscellaneous Calendar Commands
  601. ===============================
  602. `p d'
  603.      Display day-in-year (`calendar-print-day-of-year').
  604. `C-c C-l'
  605.      Regenerate the calendar window (`redraw-calendar').
  606. `SPC'
  607.      Scroll the next window (`scroll-other-window').
  608.      Exit from calendar (`exit-calendar').
  609.    To print the number of days elapsed since the start of the year, or
  610. the number of days remaining in the year, type the `p d' command
  611. (`calendar-print-day-of-year').  This displays both of those numbers in
  612. the echo area.  The number of days elapsed includes the selected date.
  613. The number of days remaining does not include that date.
  614.    If the calendar window text gets corrupted, type `C-c C-l'
  615. (`redraw-calendar') to redraw it.  (This can only happen if you use
  616. non-Calendar-mode editing commands.)
  617.    In Calendar mode, you can use `SPC' (`scroll-other-window') to
  618. scroll the other window.  This is handy when you display a list of
  619. holidays or diary entries in another window.
  620.    To exit from the calendar, type `q' (`exit-calendar').  This buries
  621. all buffers related to the calendar and returns the window display to
  622. what it was when you entered the calendar.
  623. File: emacs,  Node: Holidays,  Next: Sunrise/Sunset,  Prev: General Calendar,  Up: Calendar/Diary
  624. Holidays
  625. ========
  626.    The Emacs calendar knows about all major and many minor holidays,
  627. and can display them.
  628.      Display holidays for the selected date
  629.      (`calendar-cursor-holidays').
  630. `Mouse-2 Holidays'
  631.      Display any diary entries for the date you click on.
  632.      Mark holidays in the calendar window (`mark-calendar-holidays').
  633.      Unmark calendar window (`calendar-unmark').
  634.      List all holidays for the displayed three months in another window
  635.      (`list-calendar-holidays').
  636. `M-x holidays'
  637.      List all holidays for three months around today's date in another
  638.      window.
  639.    To see if any holidays fall on a given date, position point on that
  640. date in the calendar window and use the `h' command.  Alternatively,
  641. click on that date with `Mouse-2' and then choose `Holidays' from the
  642. menu that appears.  Either way, this displays the holidays for that
  643. date, in the echo area if they fit there, otherwise in a separate
  644. window.
  645.    To view the distribution of holidays for all the dates shown in the
  646. calendar, use the `x' command.  This displays the dates that are
  647. holidays in a different face (or places a `*' after these dates, if
  648. display with multiple faces is not available).  The command applies both
  649. to the currently visible months and to other months that subsequently
  650. become visible by scrolling.  To turn marking off and erase the current
  651. marks, type `u', which also erases any diary marks (*note Diary::.).
  652.    To get even more detailed information, use the `a' command, which
  653. displays a separate buffer containing a list of all holidays in the
  654. current three-month range.  You can use SPC in the calendar window to
  655. scroll that list.
  656.    The command `M-x holidays' displays the list of holidays for the
  657. current month and the preceding and succeeding months; this works even
  658. if you don't have a calendar window.  If you want the list of holidays
  659. centered around a different month, use `C-u M-x holidays', which
  660. prompts for the month and year.
  661.    The holidays known to Emacs include American holidays and the major
  662. Christian, Jewish, and Islamic holidays; also the solstices and
  663. equinoxes.
  664.    The dates used by Emacs for holidays are based on *current
  665. practice*, not historical fact.  Historically, for instance, the start
  666. of daylight savings time and even its existence have varied from year to
  667. year, but present American law mandates that daylight savings time
  668. begins on the first Sunday in April.  In an American locale, Emacs
  669. always uses this definition, even though it is wrong for some prior
  670. years.
  671. File: emacs,  Node: Sunrise/Sunset,  Next: Lunar Phases,  Prev: Holidays,  Up: Calendar/Diary
  672. Times of Sunrise and Sunset
  673. ===========================
  674.    Special calendar commands can tell you, to within a minute or two,
  675. the times of sunrise and sunset for any date.
  676.      Display times of sunrise and sunset for the selected date
  677.      (`calendar-sunrise-sunset').
  678. `Mouse-2 Sunrise/Sunset'
  679.      Display times of sunrise and sunset for the date you click on.
  680. `M-x sunrise-sunset'
  681.      Display times of sunrise and sunset for today's date.
  682. `C-u M-x sunrise-sunset'
  683.      Display times of sunrise and sunset for a specified date.
  684.    Within the calendar, to display the *local times* of sunrise and
  685. sunset in the echo area, move point to the date you want, and type `S'.
  686. Alternatively, click `Mouse-2' on the date, then choose
  687. `Sunrise/Sunset' from the menu that appears.  The command `M-x
  688. sunrise-sunset' is available outside the calendar to display this
  689. information for today's date or a specified date.  To specify a date
  690. other than today, use `C-u M-x sunrise-sunset', which prompts for the
  691. year, month, and day.
  692.    You can display the times of sunrise and sunset for any location and
  693. any date with `C-u C-u M-x sunrise-sunset'.  This asks you for a
  694. longitude, latitude, number of minutes difference from Coordinated
  695. Universal Time, and date, and then tells you the times of sunrise and
  696. sunset for that location on that date.
  697.    Because the times of sunrise and sunset depend on the location on
  698. earth, you need to tell Emacs your latitude, longitude, and location
  699. name before using these commands.  Here is an example of what to set:
  700.      (setq calendar-latitude 40.1)
  701.      (setq calendar-longitude -88.2)
  702.      (setq calendar-location-name "Urbana, IL")
  703. Use one decimal place in the values of `calendar-latitude' and
  704. `calendar-longitude'.
  705.    Your time zone also affects the local time of sunrise and sunset.
  706. Emacs usually gets time zone information from the operating system, but
  707. if these values are not what you want (or if the operating system does
  708. not supply them), you must set them yourself.  Here is an example:
  709.      (setq calendar-time-zone -360)
  710.      (setq calendar-standard-time-zone-name "CST")
  711.      (setq calendar-daylight-time-zone-name "CDT")
  712. The value of `calendar-time-zone' is the number of minutes difference
  713. between your local standard time and Coordinated Universal Time
  714. (Greenwich time).  The values of `calendar-standard-time-zone-name' and
  715. `calendar-daylight-time-zone-name' are the abbreviations used in your
  716. time zone.  Emacs displays the times of sunrise and sunset *corrected
  717. for daylight savings time*.  *Note Daylight Savings::, for how daylight
  718. savings time is determined.
  719. File: emacs,  Node: Lunar Phases,  Next: Other Calendars,  Prev: Sunrise/Sunset,  Up: Calendar/Diary
  720. Phases of the Moon
  721. ==================
  722.    These calendar commands display the dates and times of the phases of
  723. the moon (new moon, first quarter, full moon, last quarter).  This
  724. feature is useful for debugging problems that "depend on the phase of
  725. the moon."
  726.      Display the dates and times for all the quarters of the moon for
  727.      the three-month period shown (`calendar-phases-of-moon').
  728. `M-x phases-of-moon'
  729.      Display dates and times of the quarters of the moon for three
  730.      months around today's date.
  731.    Within the calendar, use the `M' command to display a separate
  732. buffer of the phases of the moon for the current three-month range.  The
  733. dates and times listed are accurate to within a few minutes.
  734.    Outside the calendar, use the command `M-x phases-of-moon' to
  735. display the list of the phases of the moon for the current month and the
  736. preceding and succeeding months.  For information about a different
  737. month, use `C-u M-x phases-of-moon', which prompts for the month and
  738. year.
  739.    The dates and times given for the phases of the moon are given in
  740. local time (corrected for daylight savings, when appropriate); but if
  741. the variable `calendar-time-zone' is void, Coordinated Universal Time
  742. (the Greenwich time zone) is used.  *Note Daylight Savings::.
  743. File: emacs,  Node: Other Calendars,  Next: Diary,  Prev: Lunar Phases,  Up: Calendar/Diary
  744. Conversion To and From Other Calendars
  745. ======================================
  746.    The Emacs calendar displayed is *always* the Gregorian calendar,
  747. sometimes called the "new style" calendar, which is used in most of the
  748. world today.  However, this calendar did not exist before the sixteenth
  749. century and was not widely used before the eighteenth century; it did
  750. not fully displace the Julian calendar and gain universal acceptance
  751. until the early twentieth century.  The Emacs calendar can display any
  752. month since January, year 1 of the current era, but the calendar
  753. displayed is the Gregorian, even for a date at which the Gregorian
  754. calendar did not exist.
  755.    While Emacs cannot display other calendars, it can convert dates to
  756. and from several other calendars.
  757. * Menu:
  758. * Calendar Systems::       The calendars Emacs understands
  759.                  (aside from Gregorian).
  760. * To Other Calendar::       Converting the selected date to various calendars.
  761. * From Other Calendar::       Moving to a date specified in another calendar.
  762. * Mayan Calendar::       Moving to a date specified in a Mayan calendar.
  763. File: emacs,  Node: Calendar Systems,  Next: To Other Calendar,  Up: Other Calendars
  764. Supported Calendar Systems
  765. --------------------------
  766.    The ISO commercial calendar is used largely in Europe.
  767.    The Julian calendar, named after Julius Caesar, was the one used in
  768. Europe throughout medieval times, and in many countries up until the
  769. nineteenth century.
  770.    Astronomers use a simple counting of days elapsed since noon, Monday,
  771. January 1, 4713 B.C. on the Julian calendar.  The number of days elapsed
  772. is called the *Julian day number* or the *Astronomical day number*.
  773.    The Hebrew calendar is used by tradition in the Jewish religion.  The
  774. Emacs calendar program uses the Hebrew calendar to determine the dates
  775. of Jewish holidays.  Hebrew calendar dates begin and end at sunset.
  776.    The Islamic calendar is used in many predominantly Islamic countries.
  777. Emacs uses it to determine the dates of Islamic holidays.  There is no
  778. universal agreement in the Islamic world about the calendar; Emacs uses
  779. a widely accepted version, but the precise dates of Islamic holidays
  780. often depend on proclamation by religious authorities, not on
  781. calculations.  As a consequence, the actual dates of observance can vary
  782. slightly from the dates computed by Emacs.  Islamic calendar dates begin
  783. and end at sunset.
  784.    The French Revolutionary calendar was created by the Jacobins after
  785. the 1789 revolution, to represent a more secular and nature-based view
  786. of the annual cycle, and to install a 10-day week in a rationalization
  787. measure similar to the metric system.  The French government officially
  788. abandoned this calendar at the end of 1805.
  789.    The Maya of Central America used three separate, overlapping calendar
  790. systems, the *long count*, the *tzolkin*, and the *haab*.  Emacs knows
  791. about all three of these calendars.  Experts dispute the exact
  792. correlation between the Mayan calendar and our calendar; Emacs uses the
  793. Goodman-Martinez-Thompson correlation in its calculations.
  794. File: emacs,  Node: To Other Calendar,  Next: From Other Calendar,  Prev: Calendar Systems,  Up: Other Calendars
  795. Converting To Other Calendars
  796. -----------------------------
  797.    The following commands describe the selected date (the date at point)
  798. in various other calendar systems:
  799. `Mouse-2  Other Calendars'
  800.      Display the date that you click on, expressed in various other
  801.      calendars.
  802. `p c'
  803.      Display ISO commercial calendar equivalent for selected day
  804.      (`calendar-print-iso-date').
  805. `p j'
  806.      Display Julian date for selected day
  807.      (`calendar-print-julian-date').
  808. `p a'
  809.      Display astronomical (Julian) day number for selected day
  810.      (`calendar-print-astro-day-number').
  811. `p h'
  812.      Display Hebrew date for selected day
  813.      (`calendar-print-hebrew-date').
  814. `p i'
  815.      Display Islamic date for selected day
  816.      (`calendar-print-islamic-date').
  817. `p f'
  818.      Display French Revolutionary date for selected day
  819.      (`calendar-print-french-date').
  820. `p m'
  821.      Display Mayan date for selected day (`calendar-print-mayan-date').
  822.    If you are using X windows, the easiest way to translate a date into
  823. other calendars is to click on it with `Mouse-2', then choose `Other
  824. Calendars' from the menu that appears.  This displays the equivalent
  825. forms of the date in all the calendars Emacs understands, in the form
  826. of a menu.  (Choosing an alternative from this menu doesn't actually do
  827. anything--the menu is used only for display.)
  828.    Put point on the desired date of the Gregorian calendar, then type
  829. the appropriate keys.  The `p' is a mnemonic for "print" since Emacs
  830. "prints" the equivalent date in the echo area.
  831. File: emacs,  Node: From Other Calendar,  Next: Mayan Calendar,  Prev: To Other Calendar,  Up: Other Calendars
  832. Converting From Other Calendars
  833. -------------------------------
  834.    You can use the other supported calendars to specify a date to move
  835. to.  This section describes the commands for doing this using calendars
  836. other than Mayan; for the Mayan calendar, see the following section.
  837. `g c'
  838.      Move to a date specified in the ISO commercial calendar
  839.      (`calendar-goto-iso-date').
  840. `g j'
  841.      Move to a date specified in the Julian calendar
  842.      (`calendar-goto-julian-date').
  843. `g a'
  844.      Move to a date specified in astronomical (Julian) day number
  845.      (`calendar-goto-astro-day-number').
  846. `g h'
  847.      Move to a date specified in the Hebrew calendar
  848.      (`calendar-goto-hebrew-date').
  849. `g i'
  850.      Move to a date specified in the Islamic calendar
  851.      (`calendar-goto-islamic-date').
  852. `g f'
  853.      Move to a date specified in the French Revolutionary calendar
  854.      (`calendar-goto-french-date').
  855.    These commands ask you for a date on the other calendar, move point
  856. to the Gregorian calendar date equivalent to that date, and display the
  857. other calendar's date in the echo area.  Emacs uses strict completion
  858. (*note Completion::.) whenever it asks you to type a month name, so you
  859. don't have to worry about the spelling of Hebrew, Islamic, or French
  860. names.
  861.    One common question concerning the Hebrew calendar is the computation
  862. of the anniversary of a date of death, called a "yahrzeit."  The Emacs
  863. calendar includes a facility for such calculations.  If you are in the
  864. calendar, the command `M-x list-yahrzeit-dates' asks you for a range of
  865. years and then displays a list of the yahrzeit dates for those years
  866. for the date given by point.  If you are not in the calendar, this
  867. command first asks you for the date of death and the range of years,
  868. and then displays the list of yahrzeit dates.
  869.